@extends('layout')
@section('content')
<div class="bloque row color2">
    <center><h3>Ventas</h3></center>
</div>
<div class="bloque"><div class="row">
    {{ Form::open(array('url' => 'ventas', 'method' => 'post'))}}
    <div class="form-group">
        <div class = 'col-md-4'>
             {{Form::label('fecha','Fecha')}}
            <div class="input-group">
                <div class="input-group-addon"><i class="fa fa-calendar"></i></div>
                {{Form::input('date','fecha', null, array('class'=>'form-control','required'))}}
            </div>
        </div>
        <div class = 'col-md-4 col-md-offset-4'>
            {{Form::label('num_factura','N° Factura')}}
            <div class="input-group">
                <div class="input-group-addon"><i class="fa fa-book"></i></div>
                {{Form::text('num_factura', null, array('class'=>'form-control','required'))}}
            </div>
        </div>
        <div class = 'col-md-4'>
             {{Form::label('cliente','Cliente')}}
            <div class="input-group">
                <div class="input-group-addon"><i class="fa fa-group"></i></div>
                {{Form::select('id_cliente',array('0' => 'CLIENTES') + Clienteproveedor::where('cliente',1)->lists('nombre', 'id'),null,array('class' => 'form-control','required','id'=>'cliente'))}}
                
            </div>
            <br>
            <center>{{Form::button('<i class="fa fa-group"></i>'.'Nuevo Cliente', array('class' => 'btn btn-primary', 'onClick'=>'mostrar()'))}}</center>
        </div>
        <div class = 'col-md-4 col-md-offset-4'>
             {{Form::label('contacto','Persona de Contacto')}}
            <div class="input-group">
                <div class="input-group-addon"><i class="fa fa-user"></i></div>
                 {{Form::select('contacto',array('0' => 'CONTACTOS') + Clienteproveedor::where('cliente',0)->lists('nombre', 'id'),null,array('class' => 'form-control','required'))}}
            </div>
        </div>
    </div>
    <div style="display:none">
        {{Form::text('hay_nuevo',null,array('id'=>'hay_nuevo','placeholder'=>'Nombre de Cliente'))}}
    </div>
    <div class="col-md-12 well" id="nuevocliente" style="display:none">
        <div class = 'col-md-4'>
            <div class="input-group">
            <div class="input-group-addon">
                {{Form::label('nombre','Nombre:')}}
            </div>
                {{Form::text('nombre',null,array('class'=>'form-control','id'=>'nombre','placeholder'=>'Nombre de Cliente','required'))}}
            </div><br>
            <div class="input-group">
                <div class="input-group-addon">
                    {{Form::label('direccion','Dirección:')}}
                </div>
                {{Form::text('direccion',null,array('class'=>'form-control','id'=>'direccion','placeholder'=>'Dirección'))}}
            </div>
        </div>
        <div class = 'col-md-4'>
            <div class="input-group">
                <div class="input-group-addon">
                    {{Form::label('ruc','RUC:')}}
                </div>
                {{Form::text('ruc',null,array('class'=>'form-control','id'=>'ruc','placeholder'=>'00-0000-0000','required'))}}
            </div><br>
            <div class="input-group">
                <div class="input-group-addon">
                    {{Form::label('email','Email:')}}
                </div>
                {{Form::text('email',null,array('class'=>'form-control','id'=>'email','placeholder'=>'ejemplo@ejemplo.com'))}}
            </div>
        </div>
        <div class = 'col-md-4'>
            <div class="input-group">
                <div class="input-group-addon">
                    {{Form::label('telefono','Telefono:')}}
                </div>
                {{Form::text('telefono',null,array('class'=>'form-control','id'=>'telefono','placeholder'=>'0-000-00-00'))}}
            </div>
        </div>
    </div>
</div>
    
    <div class="col-md-12 table-responsive"><br>
        <table class="table table-bordered">
            <tbody>
                <tr class="active">
                    <td><strong>Cod Ganado</strong></td>
                    <td><strong>Sexo</strong></td>
                    <td><strong>Color</strong></td>
                    <td><strong>Raza</strong></td>
                    <td><strong>Tipo</strong></td>
                    <td><strong>Precio/Kilo</strong></td>
                    <td><strong>Peso</strong></td>
                    <td><strong>SubTotal</strong></td>
                </tr>
                @foreach($ganados as $ganado)
                <tr>
                    <td>{{$ganado->cod_ganado}}</td>
                    <td>{{$ganado->sexo}}</td>
                    <td>{{$ganado->color}}</td>
                    <td>{{$ganado->id_raza}}</td>
                    <td>{{$ganado->id_tipo}}</td>
                    <td>
                        {{Form::text('data['.$ganado->id.'][precio]', null, array('class'=>'form-control', 'placeholder'=>'$','id' => 'precio_'.$ganado->id.'', 'onKeyUp'=> 'Calcular('.$ganado->id.')','required') )}}
                    </td>
                    <td>
                        {{Form::text('data['.$ganado->id.'][peso]', null, array('class'=>'form-control', 'placeholder'=>'Kg', 'id' => 'peso_'.$ganado->id.'', 'onKeyUp'=> 'Calcular('.$ganado->id.')','required'))}}
                    </td>
                    <td>
                        {{Form::text('data['.$ganado->id.'][total]', null, array('class'=>'form-control', 'placeholder'=>'$', 'id' => 'total_'.$ganado->id.''))}}
                    </td>
                </tr>
                @endforeach
            </tbody>
        </table>

    </div>
    <div class="col-md-3 col-md-offset-9">
        <td><strong>ITBM</strong></td>
        <td>{{Form::text('itbm', null, array('class'=>'form-control', 'placeholder'=>'%'))}}</td>
    </div>
    <div class="col-md-3 col-md-offset-9">
        <td><strong>Descuento</strong></td>
        <td>{{Form::text('descuento', null, array('class'=>'form-control', 'placeholder'=>'%'))}}</td>
    </div>
    {{Form::button('Guardar', array('type' => 'submit', 'class' => 'btn btn-primary'))}}
    {{Form::close()}}
</div>
@stop
@section('modal')

@stop